function genProto {
    DOMAIN=$1
    GATEWAY=$2
    PROTO_PATH=./${DOMAIN}-web/proto
    GO_OUT_PATH=./${DOMAIN}-web/proto/gen/v1
    mkdir -p $GO_OUT_PATH

    protoc -I=$PROTO_PATH --go_out=paths=source_relative:$GO_OUT_PATH --go_opt=paths=source_relative --go-grpc_out=paths=source_relative:$GO_OUT_PATH --go-grpc_opt=paths=source_relative ${DOMAIN}.proto

    if [ -n $SKIP_GATEWAY ]; then
        return
    fi

    protoc -I=$PROTO_PATH --grpc-gateway_out=paths=source_relative:$GO_OUT_PATH --grpc-gateway_opt paths=source_relative --grpc-gateway_opt grpc_api_configuration=$PROTO_PATH/${DOMAIN}.yaml ${DOMAIN}.proto
}

genProto user
genProto goods